//
//  PullCell.swift
//  Employee
//
//  Created by swordjoy on 2017/6/28.
//  Copyright © 2017年 remotevillage. All rights reserved.
//

import UIKit

class PullCell: UITableViewCell {

  static let identifiler = "PullCell.swordjoy"
  
  var title: String = "" {
    didSet { titleLabel.text = title }
  }
  
  fileprivate var titleLabel: UILabel!
  
  // MARK: - life cycle
  override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: reuseIdentifier)
    selectionStyle = .none
    backgroundColor = UIColor.white
    create()
  }
  
  override func setSelected(_ selected: Bool, animated: Bool) {
    if selected { titleLabel.textColor = GlobalConfig.BGSkyBlueColor }
    else { titleLabel.textColor = GlobalConfig.TextDeepColor }
  }
  
  required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }

}

// MARK: - fileprivate

extension PullCell {
  
  fileprivate func create() {
    titleLabel = UILabel()
    contentView.addSubview(titleLabel)
    titleLabel.textColor = GlobalConfig.TextDeepColor
    titleLabel.font = GlobalConfig.system15Font
    titleLabel.snp.makeConstraints { (make) in
      make.left.equalTo(20)
      make.centerY.equalToSuperview()
    }
  }
  
}
